﻿package mortal.game.view.daily.view
{
    import Message.DB.Tables.*;
    import com.gengine.resource.*;
    import com.mui.containers.globalVariable.*;
    import com.mui.controls.*;
    import extend.language.*;
    import fl.data.*;
    import flash.events.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.copy.escort.renderer.*;
    import mortal.game.view.daily.*;

    public class DailyShowBaseView extends GSprite
    {
        protected var _bg:GImageBitmap;
        protected var _itemReward:GTileList;
        protected var _joinBtn:GButton;
        protected var _data:TDailyViewConfig;
        protected var _isLoader:Boolean;

        public function DailyShowBaseView()
        {
            this.isHideDispose = true;
            return;
        }// end function

        private function onClickJoin(event:MouseEvent) : void
        {
            DailyUtil.oper(this._data);
            return;
        }// end function

        protected function set bgUrl(param1:String) : void
        {
            this._bg.imgUrl = param1;
            return;
        }// end function

        protected function loadBgCom() : void
        {
            this._isLoader = true;
            return;
        }// end function

        public function set data(param1:TDailyViewConfig) : void
        {
            this._data = param1;
            this._itemReward.dataProvider = new DataProvider(DailyUtil.getReward(this._data.reward));
            this._itemReward.drawNow();
            return;
        }// end function

        private function onResCompl() : void
        {
            pushUIToDisposeVec(UIFactory.gBitmap(ImagesConst.DailyTxt8, 162, 295, this));
            pushUIToDisposeVec(UIFactory.gBitmap(ImagesConst.DailyLine, 67, 304, this));
            var _loc_1:* = UIFactory.gBitmap(ImagesConst.DailyLine, 327, 304, this);
            _loc_1.scaleX = -1;
            pushUIToDisposeVec(_loc_1);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap("", 0, 0, this, this.loadBgCom);
            this._itemReward = UIFactory.tileList(21, 345, 360, 50, this);
            this._itemReward.setStyle("cellRenderer", BgItemCellRenderer);
            this._itemReward.columnWidth = 45;
            this._itemReward.rowHeight = 45;
            this._itemReward.selectable = false;
            this._itemReward.direction = GBoxDirection.HORIZONTAL;
            this._itemReward.center = 21;
            this._joinBtn = UIFactory.gButton("" + Language.getString(71042), 152, 408, 94, 32, this, "BrownBtn");
            this._joinBtn.configEventListener(MouseEvent.CLICK, this.onClickJoin);
            LoaderHelp.addResCallBack(ResFileConst.daily, this.onResCompl);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            LoaderHelp.removeResEvent(ResFileConst.daily, this.onResCompl);
            this._isLoader = false;
            this._bg.dispose(param1);
            this._itemReward.dispose(param1);
            this._joinBtn.dispose(param1);
            this._bg = null;
            this._itemReward = null;
            this._joinBtn = null;
            return;
        }// end function

    }
}
